<?php

require_once ('./includes.php');


$user = $_SESSION['user'];

$noticia = new post();

$noticia->setTitulo($_POST['titulo']);
$noticia->setTexto($_POST['resumen'].'[lm]'.$_POST['texto']);
$noticia->setforeign_usuario($user);
$noticia->setFecha(date("Y-m-d G:i "));

$sub = subforoQuery::create()->findPk($_POST['subforo']);

$noticia->setforeign_subforo($sub);
$noticia->setforeign_imagen(imagenesQuery::create()->findPk($_POST['imagen']));

$noticia->save();

$host3 = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'adminNoticias.php';
header("Location: http://" . $host3 . $uri . "/" . $extra);
die();
?>
